<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Education Management System</title>
    <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='stylesheets/admin_index.css') }}">
    <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='stylesheets/index.css') }}">
    <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='stylesheets/tw.css') }}">
</head>

<body>

    <header>
        <span class="title">Educational Management System</span>
        <a id="logout-btn" href="/logout">Logout</a>
        <a id="welcome">Welcome, {{name}} ({{kind}})</a>
    </header>

    <div style="height: calc(100vh - 76px);" class="flex items-start w-full">
        <nav id="sidebar">
            <ul>
                <li><a href="/">Home</a></li>
                <li><a href="/enroll">Course Enrollment</a></li>
                <li><a href="/message">Messages</a></li>
                <li><a href="/assignment/student">Assignment Submit</a></li>
                <li><a href="/forum" class="active">Forum</a></li>
            </ul>
        </nav>
    
        <div class="table_display_div flex-auto">
          <div class="table_head">
            <b>Search Forums</b>
            <form class="table_search" name="message_search" id="message_search" method="get">
                <input type="text" name="search_input" id="search_input" class="input">
                <input type="submit" name="search" id="search" value="Search" class="input-btn">
            </form>
            <button class="stroke-btn" name="requests" id="requests" type="button" onclick="window.location.href='/forum/create'">
              Create Forum
          </button>
        </div>
        <table class="table_display" id="course_table" name="course_table">
            <thead>
                <tr>
                    <th>Forum ID</th>
                    <th>Category</th>
                    <th>Title</th>
                    <th>Content</th>
                    <th>Author</th>
                    <th>Details</th>
                    <th>Operations</th>
                </tr>
            </thead>
            <tbody>
                {% for forum in forums %}
                <tr>
                    <td>1</td>
                    <td>course</td>
                    <td>forum title</td>
                    <td class="ellipsis">forum content xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</td>
                    <td>author</td>
                    <td><a href="/forum/view?forum_id={{forum[0]}}" class="main-btn">View</a></td>
                    <td>
                      <a href="/forum/comment?forum_id={{forum[0]}}" class="main-btn mr-3">Comment</a>
                      <!-- 管理员可进行删除操作 -->
                      <a href="/forum/delete?forum_id={{forum[0]}}" class="warn-btn">Delete</a>
                    </td>
                </tr>
                {% endfor %}
            </tbody>
        </table>
        </div>
    </div>

    <footer></footer>

    <script src="{{ url_for('static', filename='js/main.js') }}"></script>

</body>

</html>
